package indi.zhifa.study2024.nbr.gen.busy.domain.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import indi.zhifa.core.mpenhance.entity.annotations.ZfDbService;
import indi.zhifa.study2024.nbr.gen.busy.domain.po.GenDomainEntity;
import indi.zhifa.study2024.nbr.gen.busy.domain.mapper.GenDomainMapper;
import indi.zhifa.study2024.nbr.gen.busy.domain.service.IGenDomainDbService;
import indi.zhifa.core.mpenhance.service.impl.ZfDbServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 片区 服务实现类
 * </p>
 *
 * @author 织法
 * @since 2024-12-01
 */
@ZfDbService(name="GenDomainEntity")
public class GenDomainDbServiceImpl extends ZfDbServiceImpl<GenDomainMapper, GenDomainEntity> implements IGenDomainDbService {

    @Override
    public boolean existByCode(Long parentId ,String code) {
        LambdaQueryWrapper<GenDomainEntity> queryWrapper = Wrappers.<GenDomainEntity>lambdaQuery()
                .eq(GenDomainEntity::getParentId, parentId)
                .eq(GenDomainEntity::getCode, code);
        return exist(queryWrapper);
    }

    @Override
    public List<GenDomainEntity> listByCascadeCode(List<String> pCascadeCodeList) {
        LambdaQueryWrapper<GenDomainEntity> queryWrapper = Wrappers.<GenDomainEntity>lambdaQuery()
                .in(GenDomainEntity::getParentId, pCascadeCodeList);

        return list(queryWrapper);
    }
}
